Move URI::HTTP#authority to URI::Generic#193
Open
rhenium wants to merge 3 commits intoruby:masterfrom
Open
Conversation
Do not use #authority here, since a web origin is defined as a triple of (scheme, host, port), which is different from a URI authority.
Rename methods URI::Generic#authority and #set_authority added in commit 6c6449e (Add authority accessor, 2025-06-26). The name "authority" conflicts with the existing URI::HTTP#authority which returns the composed authority component rather than an array of subcomponents.
The concept of authority is not specific to http/https URIs, so URI::Generic is more appropriate place for this method. This also fixes the missing userinfo part in the authority.
Contributor
|
+1. I initially added it as part of adding |
sorah
approved these changes
Nov 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
URI::HTTP#authorityshould belong toURI::Genericsince the concept of an authority isn't specific to http or https URIs: https://datatracker.ietf.org/doc/html/rfc3986#section-3.2However,
URI::Generic#authoritywas recently taken in commit 6c6449e, where it returns a list of subcomponents of the authority. This has made into v1.0.4 (2025-10-07).Although it has a public visibility, it seems to have been intended for internal use, as there are no direct tests for it and no mention in the GitHub release notes. If it's not too late, I'd like to rename it to something else. In this PR, I've renamed it to "authority_components".
This PR also fixes
URI::HTTP#authority(nowURI::Generic#authority) skipping the userinfo part.@nobu @HoneyryderChuck What do you think?